package com.sy.controller;

import com.sy.dto.JsonResult;
import com.sy.entity.Course;
import com.sy.sevice.CourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Monkey-D-Gu
 * @version 1.0
 * @date 2020/9/14 0014 11:51
 * @usage 课程相关的控制类
 */
@RestController
@RequestMapping("courses")
public class CourseController {

    @Autowired
    private CourseService courseService;

    /**
     * 添加课程信息
     * @return JsonResult对象
     */
    @RequestMapping(value = "",method = RequestMethod.POST)
    public JsonResult addCourse(@RequestBody Course course){
        System.out.println(course);
        return courseService.addCourse(course);
    }
}
